package com.sbr.seb.entity;

import java.io.Serializable;
import java.util.StringTokenizer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Log implements Serializable {

	private static final Logger logger = LoggerFactory.getLogger(Log.class);
	
	public enum LogLevel {

			DEBUG,
			INFO,
			WARN,
			ERROR;
			
	}
	
	private final String completeLog;
	private String level;
	private String timestamp;
	private String message;
	private String fromClass;
	
	public Log(String completeLog) {
		this.completeLog = completeLog;
		init();
	}
	
	public void init() {
		logger.debug("begin");
		StringTokenizer st = new StringTokenizer(completeLog,"|");
		level = st.nextToken().trim();
		logger.debug("level = "+level);
		timestamp = st.nextToken().trim();
		logger.debug("timestamp = "+timestamp);
		message = st.nextToken().trim();
		logger.debug("message = "+message);
	}
	
	public String getLevel() {
		return level;
	}
	public void setLevel(String level) {
		this.level = level;
	}
	public String getTimestamp() {
		return timestamp;
	}
	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}

	public String getFromClass() {
		return fromClass;
	}

	public void setFromClass(String fromClass) {
		this.fromClass = fromClass;
	}

	public String getCompleteLog() {
		return completeLog;
	}

}
